<template>
	<view class="content">
		<view style="padding-top: 70upx;padding-bottom: 60upx;">
			<view style="font-size: 50upx;">管理员登陆</view>
		</view>
		<view>
			<input class="input" placeholder="管理员账号" type="text" v-model="username" />
			<input class="input" password placeholder="管理员密码" type="text" v-model="password" />
		</view>

		<view class="button">
			<button style="background-color: #51a938; color: #FFFFFF;" @click="login()">登陆</button>
			<view style="font-size:30upx; padding-top: 20upx; color: #808080; text-align: center;" @click="returnRegister()">返回注册</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: '',
				password: ''
			}
		},
		methods: {
			login() {
				if (this.username === '' || this.password === '') {
					uni.showToast({
						title: '用户名或密码为空！',
						icon: 'none',
					});
				} else {
					console.log(this.username)
					if (this.username == 'root' && this.password == 'root') {
						uni.navigateTo({
							url: '../pagejump/pagejump'
						})
					} else {
						uni.showToast({
							icon: "none",
							title: "用户名或者密码错误！",
						})
					}
				}
			},
			returnRegister() {
				uni.navigateTo({
					url: '../index/index'
				})
			}
		}
	}
</script>

<style>
	.input {
		height: 120upx;
		width: 600upx;
		border: 0;
		border-bottom: 2upx solid #C8C7CC;
		background: #FFFFFF;
	}

	.content {
		padding-left: 80upx;
	}

	.button {
		width: 600upx;
		padding-top: 60upx;
	}
</style>
